import request from './request'
import { useUserStore } from "../store/modules/user"

// 获取服务商人员及地址下拉数据
export function getNetworkEmpAddressPageSelect(data) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/networkSelect/getNetworkEmpAddressPageSelect',
        method: 'post',
        headers: token,
        data,
    })
}

// 获取服务商及地址下拉数据
export function getNetworkAddressPageSelect(data) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/networkSelect/getNetworkAddressPageSelect',
        method: 'post',
        headers: token,
        data,
    })
}




//获取仓库列表
export function getListStore(data: object) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/getList',
        method: 'post',
        headers: token,
        data,
    })
}
//批量修改允许或不允许负库存
export function canNegativeStock(data, canNegativeStock) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/canNegativeStock?canNegativeStock=' + canNegativeStock,
        method: 'put',
        headers: token,
        data,
    })
}
//批量删除仓库
export function deleteStore(data) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/delete',
        method: 'DELETE',
        headers: token,
        data,
    })
}
//批量启用或禁用仓库
export function disableStore(data, status) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/disable?status=' + status,
        method: 'put',
        headers: token,
        data,
    })
}
// 根据仓库ID获取仓库详情修改
export function getDetailStore(id) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: `/store/getDetail/${id}`,
        method: 'get',
        headers: token,
    })
}
// 新增或修改仓库
export function saveStore(data) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: `/store/save`,
        method: 'post',
        headers: token,
        data
    })
}
// 获取仓库列表本月的入-出库的数量
export function getListCurrentMothInWidthOutStoreQty() {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: `/store/getListCurrentMothInWidthOutStoreQty`,
        method: 'get',
        headers: token,

    })
}
// 根据仓库ID获取仓库库存明细
export function getStoreDetailGoodsList(data, id) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: `/store/getStoreDetailGoodsList/` + id,
        method: 'post',
        headers: token,
        data
    })
}
// 根据仓库ID获取仓位列表
export function getStorePositionList(data, id) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: `/store/getStorePositionList/` + id,
        method: 'post',
        headers: token,
        data
    })
}
// 根据仓位ID获取仓位库存明细
export function getStorePositionDetailGoodsList(data, id) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: `/store/getStorePositionDetailGoodsList/` + id,
        method: 'post',
        headers: token,
        data
    })
}
// 设置
// 获取仓库类型列表
export function getStoreTypeList(data) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: `/store/type/getList`,
        method: 'post',
        headers: token,
        data
    })
}
// 新增或修改仓库类型
export function addStoreType(data) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: `/store/type/save`,
        method: 'post',
        headers: token,
        data
    })
}
//批量删除仓库类型
export function deleteStoreType(data) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/type/delete',
        method: 'DELETE',
        headers: token,
        data,
    })
}
//批量启用或禁用仓库类型
export function disableStoreType(data, status) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/type/disable?status=' + status,
        method: 'put',
        headers: token,
        data,
    })
}
// 根据仓库类型ID获取详情
export function getDetailStoreType(id) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: `/store/type/getDetail/${id}`,
        method: 'get',
        headers: token,
    })
}
// 获取商品库存
export function getGoodsStock(data) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: `/store/goods/stock/getGoodsStock`,
        method: 'post',
        headers: token,
        data
    })
}
// 仓库下拉列表查询
export function storePageSelect(data, storeType) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/select/storePageSelect/' + storeType,
        method: 'post',
        headers: token,
        data
    })
}

// 根据仓库ID获取仓位下拉列表
export function storePositionPageSelect(data, storeId) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/select/storePositionPageSelect/' + storeId,
        method: 'post',
        headers: token,
        data
    })
}
// 仓库人员地址下拉列表查询
export function storeEmpAddressPageSelect(data, storeType) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/select/storeEmpAddressPageSelect/' + storeType,
        method: 'post',
        headers: token,
        data
    })
}

// 出库列表
export function outboundList(data) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/outbound/getList',
        method: 'post',
        headers: token,
        data
    })
}
// 出库仓库类型下拉列表查询
export function outStoreTypePageSelect(data) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/select/outStoreTypePageSelect',
        method: 'post',
        headers: token,
        data
    })
}
// 根据出库单ID获取出库详情
export function getOutboundDetail(id) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/outbound/getOutboundDetail/' + id,
        method: 'get',
        headers: token,
    })
}
//根据出库单ID获取出库物料
export function getOutboundMaterial(id) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/outbound/getOutboundMaterial/' + id,
        method: 'get',
        headers: token,
    })
}
// 保存或审核出库单
export function saveOrCheck(data, submitType) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/outbound/saveOrCheck/' + submitType,
        method: 'post',
        headers: token,
        data
    })
}
// 作废出库单
export function cancelStoreOutbound(data, id) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/outbound/cancelStoreOutbound/' + id,
        method: 'post',
        headers: token,
        data
    })
}
// 获取在库的一物一码
export function getInStoreCodeList(data) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/outbound/getInStoreCodeList',
        method: 'post',
        headers: token,
        data
    })
}
// 确认出库
export function saveSureStoreOutbound(data, id) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/outbound/saveSureStoreOutbound/' + id,
        method: 'post',
        headers: token,
        data
    })
}
//获取出入库商品
export function getInOrOutStoreGoods(data, type) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/product/getInOrOutStoreGoods/' + type,
        method: 'post',
        headers: token,
        data
    })
}


//根据入库单ID获取入库单详情
export function getInboundDetail(id) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/inbound/getInboundDetail/' + id,
        method: 'get',
        headers: token,
    })
}
//根据入库单ID获取入库单详情物料
export function getInboundDetailMaterial(id) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/inbound/getInboundDetailMaterial/' + id,
        method: 'get',
        headers: token,
    })
}
// 获取入库列表
export function inboundList(data) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/inbound/getList',
        method: 'post',
        headers: token,
        data
    })
}

// 获取未出入库的一物一码
export function getStoreCodeList(data) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/inbound/getStoreCodeList',
        method: 'post',
        headers: token,
        data
    })
}
// 保存或保存并审核入库单
export function saveinboundCheck(data, submitType) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/inbound/save/' + submitType,
        method: 'post',
        headers: token,
        data
    })
}

//确认入库
export function saveSureStoreInbound(data, id) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/inbound/saveSureStoreOutbound/' + id,
        method: 'post',
        headers: token,
        data
    })
}


//入库仓库类型下拉列表查询
export function inStoreTypePageSelect(data) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/select/inStoreTypePageSelect',
        method: 'post',
        headers: token,
        data
    })
}

//获取物流下拉列表
export function getLogisticsSelectList(data) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/system/logistics/getLogisticsSelectList',
        method: 'post',
        headers: token,
        data
    })
}
// 获取出库收货客户信息
export function getOutStoreReceiptsUser(data) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/outbound/getOutStoreReceiptsUser',
        method: 'post',
        headers: token,
        data
    })
}

// 驳回出库单
export function rejectOutbound(data,id) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/outbound/rejectOutbound/'+id,
        method: 'post',
        headers: token,
        data
    })
}

// 驳回入库单
export function rejectInbound(data,id) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/inbound/rejectInbound/'+id,
        method: 'post',
        headers: token,
        data
    })
}
// 作废入库单
export function cancelStoreInbound(data, id) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/store/inbound/cancelStoreInbound/' + id,
        method: 'post',
        headers: token,
        data
    })
}